package myJs.tool

import scala.scalajs.js.Date

/**
	*Created by yz on 1/3/2023
	*/object Tool {

  val confirmButtonClass = "btn-danger"
  val cancelButtonClass = "green"

  def timeBefore = (dateStr: String, dbDateStr: String) => {
    val date = new Date(dateStr)
    val dbDate = new Date(dbDateStr)
    dbDate.setUTCHours(0, 0, 0, 0)
    date.getTime() <= dbDate.getTime()
  }

  def timeAfter = (dateStr: String, dbDateStr: String) => {
    val date = new Date(dateStr)
    val dbDate = new Date(dbDateStr)
    dbDate.setUTCHours(0, 0, 0, 0)
    date.getTime() >= dbDate.getTime()
  }

  val pattern = "yyyy-mm-dd"

  def b2Display(b: Boolean) = {
    if (b) "block" else "none"
  }

}
